<?php
error_reporting(0);
$isadmin=1; 
include '../comm/config.php';
include '../comm/checkpostandget.php';
include 'check.php';
session_start();
$adminusername=$_SESSION["adminusername"]; $newusername=$_POST['username']; $oldpassword=md5($_POST['oldpassword']);
$newpassword=md5($_POST['newpassword']);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理中心</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.STYLE1 {
	color: #FFFFFF;
	font-weight: bold;
	font-size:14px;
	text-decoration:none;
}
.STYLE2 {
	color: #555555;
	font-weight: bold;
	font-size:14px;
	text-decoration:none;
}
.STYLE3 {color: #FF0000}
.STYLE4 {
	font-size: 14px;
	font-weight: bold;
}
-->
</style>
</head>

<body topmargin="5" leftmargin="0">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="282" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td>
          <table cellspacing="0" width="100%" height="207" style="border:1px  solid #DCEAF7;">
            <tr>
              <td height="30" colspan="2" bgcolor="E9F2FB" class="bigtext"><strong>&nbsp;<img src="images/arrow.gif" width="16" height="22" align="absmiddle" /> 修改管理员信息</strong></td>
            </tr>
            <tr>
              <td width="100%" colspan="2" valign="top"><table width="100%" height="300" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td valign="top"><table width="571" height="152" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="28">&nbsp;</td>
    <td width="543" class="bigtext">
<?php
$q="select * from ".$BIAOTOU."duoduo2010 where (adminname='$adminusername' and adminpass='$oldpassword')";
$rs=mysql_query($q);
$num = mysql_num_rows($rs);
if($num)
{
	$q = "update ".$BIAOTOU."duoduo2010 set adminpass='$newpassword',adminname='$newusername' where adminname='$adminusername'";
	mysql_query($q);	
	$_SESSION["adminusername"]="";
	admin_log('修改初始管理员');
	echo "管理员帐号和密码修改成功！<a href=login.php class=link4 target=_parent>请重新登录</a>";
}
else
{
	echo "错误：原密码输入有误！";
}
mysql_close();
?></td>
  </tr>
</table></td></tr>
              </table></td>
            </tr>
          </table></td>
        </tr>
      
    </table></td>
  </tr>
</table>
</body>
</html> 